package com.zqx.visitor.concretevisitor;

import com.zqx.visitor.abstractvisitor.Department;
import com.zqx.visitor.concreteelement.FulltimeEmployee;
import com.zqx.visitor.concreteelement.ParttimeEmployee;
import lombok.extern.slf4j.Slf4j;

/**
 * description: 具体访问者类
 * @author zqx
 * @date 2018/09/06
 */
@Slf4j
public class HRDepartment  extends Department{

    //实现人力资源部对全职员工的访问
    @Override
    public void visit(FulltimeEmployee employee) {
        int workTime = employee.getWorkTime();
        log.info("【正式员工】"+employee.getName()+"实际工作时间为："+workTime+"小时。");
        if(workTime > 40){
            log.info("【正式员工】"+employee.getName()+"加班时间为："+(workTime-40)+"小时。");
        }else if(workTime < 40){
            log.info("【正式员工】"+employee.getName()+"请假时间为："+(40-workTime)+"小时。");
        }
    }

    //实现人力资源部对兼职员工的访问
    @Override
    public void visit(ParttimeEmployee employee) {
        int workTime = employee.getWorkTime();
        System.out.println("【临时工】"+employee.getName()+"实际工作实际为："+employee.getHourWage()+"小时。");
    }
}
